﻿namespace Pottery.FrontEnd.ViewModels
{
    using System;
    using System.ComponentModel.DataAnnotations;
    using System.Web.Mvc;
    using Pottery.Module.Store;
    using Pottery.Model.Infrastructure;
    using Pottery.Module.Infrastructure.Models;

    public class RegistrationViewModel : IAssignable
    {
        #region IAssignable members

        public void AssignTo(object obj)
        {            
            if (obj is User)
            {
                //User user = new User(Login,Password,FirstName,LastName,Email,
                return;
            }

            throw new NotSupportedException();
        }

        #endregion IAssignable members      
        
        #region Properties

        /// <summary>
        /// Unique User Login
        /// </summary>
        [Display(Name = "Login", ResourceType = typeof(Resources.Registration))]
        [Required(ErrorMessageResourceName = "LoginErrorMessage", ErrorMessageResourceType = typeof(Resources.Registration))]
        [StringLength(ModelConstants.MAX_LOGIN_LENGTH, MinimumLength = ModelConstants.MIN_LOGIN_LENGTH, ErrorMessageResourceName = "ValidLoginLengthMessage", ErrorMessageResourceType = typeof(Resources.Registration))]
        [DisplayFormat(ConvertEmptyStringToNull = false)]
        [DataType(DataType.Text)]
        public string Login { get; set; }

        /// <summary>
        /// User Name
        /// </summary>
        [Display(Name = "FirstName", ResourceType = typeof(Resources.Registration))]
        [Required(ErrorMessageResourceName = "FirstNameErrorMessage", ErrorMessageResourceType = typeof(Resources.Registration))]
        [StringLength(ModelConstants.MAX_FIRST_NAME_LENGTH, ErrorMessageResourceName = "ValidNameLengthMessage", ErrorMessageResourceType = typeof(Resources.Registration))]
        [DisplayFormat(ConvertEmptyStringToNull = false)]
        [DataType(DataType.Text)]
        public string FirstName { get; set; }

        /// <summary>
        /// User Surname
        /// </summary>
        [Display(Name = "LastName", ResourceType = typeof(Resources.Registration))]
        [Required(ErrorMessageResourceName = "LastNameErrorMessage", ErrorMessageResourceType = typeof(Resources.Registration))]
        [StringLength(ModelConstants.MAX_LAST_NAME_LENGTH, ErrorMessageResourceName = "ValidSurnameLengthMessage", ErrorMessageResourceType = typeof(Resources.Registration))]
        [DisplayFormat(ConvertEmptyStringToNull = false)]
        [DataType(DataType.Text)]
        public string LastName { get; set; }

        /// <summary>
        /// User Email
        /// </summary>
        [Display(Name = "Email", ResourceType = typeof(Resources.Registration))]
        [Required(ErrorMessageResourceName = "EmailErrorMessage", ErrorMessageResourceType = typeof(Resources.Registration))]
        [StringLength(ModelConstants.MAX_EMAIL_LENGTH, ErrorMessageResourceName = "ValidEmailLengthMessage", ErrorMessageResourceType = typeof(Resources.Registration))]
        [DisplayFormat(ConvertEmptyStringToNull = false)]
        [RegularExpression(ModelConstants.EMAIL_REGULAR_EXPRESSION, ErrorMessageResourceName = "ValidEmailErrorMessage", ErrorMessageResourceType = typeof(Resources.Registration))]
        [DataType(DataType.EmailAddress, ErrorMessageResourceName = "ValidEmailErrorMessage", ErrorMessageResourceType = typeof(Resources.Registration))]
        public string Email { get; set; }

        /// <summary>
        /// User Password
        /// </summary>
        [Display(Name = "Password", ResourceType = typeof(Resources.Registration))]
        [Required(ErrorMessageResourceName = "PasswordErrorMessage", ErrorMessageResourceType = typeof(Resources.Registration))]
        [StringLength(ModelConstants.MAX_PASSWORD_LENGTH, MinimumLength = ModelConstants.MIN_LOGIN_LENGTH, ErrorMessageResourceName = "ValidPasswordLengthMessage", ErrorMessageResourceType = typeof(Resources.Registration))]
        [DisplayFormat(ConvertEmptyStringToNull = false)]
        [DataType(DataType.Password)]
        public string Password { get; set; }

        /// <summary>
        /// User Confirm Password 
        /// </summary>
        [Display(Name = "ConfirmPassword", ResourceType = typeof(Resources.Registration))]
        [Required(ErrorMessageResourceName = "ConfirmPasswordErrorMessage", ErrorMessageResourceType = typeof(Resources.Registration))]
        [StringLength(ModelConstants.MAX_PASSWORD_LENGTH, MinimumLength = ModelConstants.MIN_LOGIN_LENGTH, ErrorMessageResourceName = "ValidPasswordLengthMessage", ErrorMessageResourceType = typeof(Resources.Registration))]
        [DisplayFormat(ConvertEmptyStringToNull = false)]
        [DataType(DataType.Password)]
        [Compare("Password", ErrorMessageResourceName = "ValidConfirmPasswordErrorMessage", ErrorMessageResourceType = typeof(Resources.Registration))]
        public string ConfirmPassword { get; set; }

        /// <summary>
        /// CheckBox for Age
        /// </summary>
        [Display(Name = "CheckBoxAge", ResourceType = typeof(Resources.Registration))]
        ////!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
        [Compare("True", ErrorMessageResourceName = "CheckBoxAgeErrorMessage", ErrorMessageResourceType = typeof(Resources.Registration))]
        [Required(ErrorMessageResourceName = "CheckBoxAgeErrorMessage", ErrorMessageResourceType = typeof(Resources.Registration))]
        public bool CheckBoxAge { get; set; }

        /// <summary>
        /// Check Box for agreement with rules
        /// </summary>
        [Display(Name = "CheckBoxAgreeWithRules", ResourceType = typeof(Resources.Registration))]
        ////!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
        [Required(ErrorMessageResourceName = "CheckBoxAgreeWithRulesErrorMessage", ErrorMessageResourceType = typeof(Resources.Registration))]
        [Compare("True", ErrorMessageResourceName = "CheckBoxAgreeWithRulesErrorMessage", ErrorMessageResourceType = typeof(Resources.Registration))]
        public bool CheckBoxAgreeWithRules { get; set; }

        #endregion Properties*/
    }
}